﻿using SqlSugar;
using Store.Manager.ERP.Domain.Entities;
using Store.Manager.ERP.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Store.Manager.ERP.Infrastructure
{
    public class UserRepository : Repository<User>, IUserRepository
    {
        public UserRepository(ISqlSugarClient db) : base(db) { }
        public async Task AddUserAsync(User user)
        {
            await base.InsertAsync(user);
        }

        public async Task<User> GetUserByUsernameAsync(string username)
        {
            return await base.Context.Queryable<User>()
              .Where(u => u.Username == username)
              .FirstAsync();
        }
    }
}
